<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
    </div>
    <script>
        //1.获取元素
        var div = document.querySelector("div")
        var t = 3;
            //location.href属性 如果输出的话 即当前浏览器访问的浏览地址
            //如果对location.href属性赋值则为跳转到指定的地址页面
            var timer = setInterval(function(){
                //如果时间不为0，则让时间递减，否则
                if(t === 0){
                    location.href = "http://www.baidu.com"
                    clearInterval(timer)
                }else{
                    div.innerHTML = '系统将在'+t+'秒后自动跳转'
                    t--;
                }
            },1000)
    </script>
</body>
</html>